package com.fulin.thread.queue.delayqueue;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
*
* @description 
* @auther fulin16@crnet.com.hk
* @since 2019年4月13日 下午3:34:48
*
*/
public class Consumer {
	public void execute(){
		new Thread(new Runnable() {
			@Override
			public void run() {
				while(true){
					try {
						System.out.println(Cache.take().getBody());
						System.out.println(time());
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				}
			}
		}).start();
	}
	
	public static String time(){
		LocalDateTime ldt = LocalDateTime.now();
		DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH:mm:ss");
		String format = ldt.format(dtf);
		return format;
	}
}
